# Copyright (c) Meta Platforms, Inc. and affiliates.

load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("../defs.bzl", "zs_cxxbinary", "zs_cxxlibrary", "zs_library", "zs_unittest")

oncall("data_compression")

zs_cxxlibrary(
    name = "arg",
    srcs = glob(["arg/**/*.cpp"]),
    headers = glob(["arg/**/*.h"]),
)

zs_library(
    name = "fileio",
    srcs = [
        "fileio/fileio.c",
    ],
    headers = [
        "fileio/fileio.h",
    ],
    exported_deps = [
        "..:common",
    ],
)

zs_cxxlibrary(
    name = "zstrong_cpp",
    srcs = ["zstrong_cpp.cpp"],
    headers = ["zstrong_cpp.h"],
    exported_deps = [
        "..:zstronglib",
        "../cpp:openzl_cpp",
        "../custom_transforms/json_extract:json_extract",
        "../custom_transforms/parse:parse",
        "../custom_transforms/thrift:thrift_lib",
    ],
)

zs_cxxlibrary(
    name = "zstrong_ml",
    srcs = ["zstrong_ml.cpp"],
    headers = ["zstrong_ml.h"],
    compiler_flags = ["-Wno-float-equal"],
    strict_conversions = False,
    deps = ["//folly:base64"],
    exported_deps = [
        "gbt_predictor:zstrong_gbt_predictor",
        ":zstrong_cpp",
        "//folly:base64",
        "//folly:dynamic",
        "//folly:synchronized",
    ],
)

zs_cxxlibrary(
    name = "zstrong_json",
    srcs = ["zstrong_json.cpp"],
    headers = ["zstrong_json.h"],
    compiler_flags = ["-Wno-float-equal"],
    strict_conversions = False,
    deps = [
        "//folly:base64",
        "//folly:file_util",
        "//folly:memory",
        "//folly/lang:bits",
    ],
    exported_deps = [
        "..:zstronglib",
        ":zstrong_cpp",
        "//folly:base64",
        "//folly:dynamic",
        "//folly:file_util",
        "//folly:memory",
        "//folly/lang:bits",
    ],
)

cpp_library(
    name = "json",
    headers = ["json.hpp"],
    exported_deps = [],
)

zs_cxxbinary(
    name = "make_canonical_parquet",
    srcs = ["parquet/make_canonical_parquet.cpp"],
    compiler_flags = [
        "-Wno-switch-enum",
        "-Wno-shadow",
    ],
    deps = [
        "fbsource//third-party/apache-arrow:arrow",
        ":arg",
        ":io",
    ],
)

zs_library(
    name = "timefn",
    srcs = [
        "time/timefn.c",
    ],
    headers = [
        "time/timefn.h",
    ],
    exported_deps = [
        "..:common",
    ],
)

zs_unittest(
    name = "test_timefn",
    srcs = [
        "time/tests/test_time.cpp",
    ],
    deps = [
        ":timefn",
    ],
)

zs_cxxlibrary(
    name = "logger",
    srcs = [
        "logger/Logger.cpp",
    ],
    headers = [
        "logger/Logger.h",
    ],
    deps = [],
)

zs_cxxlibrary(
    name = "io",
    srcs = glob(["io/**/*.cpp"]),
    headers = glob(["io/**/*.h"]),
    exported_deps = [
        "../cpp:openzl_cpp",
        ":logger",
    ],
)
